/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package modeladesktop.graficas;

import org.jfree.data.DomainOrder;
import org.jfree.data.general.AbstractSeriesDataset;
import org.jfree.data.xy.XYDataset;
import umontreal.iro.lecuyer.probdist.FisherFDist;

/**
 *
 * @author Alvaro
 *
 * Estado: Completo
 *
 */
public class TestFDataSet extends AbstractSeriesDataset implements XYDataset {
    
    private int freedom1;
    private int freedom2;
    private int seriescount;
    private double ftabla;
    private double fcalculado;

    public TestFDataSet(int freedom1, int freedom2, double ftablaX, double fcalculadoX){
        this.freedom1=freedom1;
        this.freedom2=freedom2;
        this.ftabla=ftablaX;
        this.fcalculado=fcalculadoX;
        seriescount=3;
    }

    @Override
    public int getSeriesCount() {
        return seriescount;
    }

    @Override
    public Comparable getSeriesKey(int i) {
        switch(i){
            case 0:
                return "Y = F(x)";
            case 1:
                return "FCalculada";
            case 2:
                return "FTabla";
        }
        return "Error";
    }

    public DomainOrder getDomainOrder() {
        return DomainOrder.NONE;
    }

    public int getItemCount(int i) {
        return 35;
    }

    public Number getX(int i, int i1) {
        switch(i){
            case 0:
                return new Double(i1 / 10.0);
            case 1:
                return ftabla;
        }
        return fcalculado;
    }

    public double getXValue(int i, int i1) {
        switch(i){
            case 0:
                return i1 / 10.0;
            case 1:
                return ftabla;
        }
        return fcalculado;
    }

    public Number getY(int i, int i1) {
        return FisherFDist.density(freedom1, freedom2, i1 / 10.0);
    }

    public double getYValue(int i, int i1) {
        return FisherFDist.density(freedom1, freedom2, i1 / 10.0);
    }
}
